#include "Cube.h"
#include "SDL.h"
#include "SDL_opengl.h"
#include <string>

Cube::Cube(void)
{
	rotationAngle = 0.0f;
}


Cube::~Cube(void)
{
}

void Cube::rotate()
{
	rotationAngle+= 0.15f;
}

void Cube::draw()
{
	glClear(GL_COLOR_BUFFER_BIT);
    glMatrixMode( GL_MODELVIEW );
	glTranslatef(0, 0, 0);
	glRotatef(rotationAngle, 1.0f, 1.0f, 1.0f);
	glBegin(GL_QUADS);
      glColor3f(   0.0f,  1.0f,  0.0f ); /* Set The Color To Green           */
      glVertex3f(  0.3f,  0.3f, -0.3f ); /* Top Right Of The Quad (Top)      */
      glVertex3f( -0.3f,  0.3f, -0.3f ); /* Top Left Of The Quad (Top)       */
      glVertex3f( -0.3f,  0.3f,  0.3f ); /* Bottom Left Of The Quad (Top)    */
      glVertex3f(  0.3f,  0.3f,  0.3f ); /* Bottom Right Of The Quad (Top)   */

      glColor3f(   1.0f,  0.5f,  0.0f ); /* Set The Color To Orange          */
      glVertex3f(  0.3f, -0.3f,  0.3f ); /* Top Right Of The Quad (Botm)     */
      glVertex3f( -0.3f, -0.3f,  0.3f ); /* Top Left Of The Quad (Botm)      */
      glVertex3f( -0.3f, -0.3f, -0.3f ); /* Bottom Left Of The Quad (Botm)   */
      glVertex3f(  0.3f, -0.3f, -0.3f ); /* Bottom Right Of The Quad (Botm)  */

      glColor3f(   1.0f,  0.0f,  0.0f ); /* Set The Color To Red             */
      glVertex3f(  0.3f,  0.3f,  0.3f ); /* Top Right Of The Quad (Front)    */
      glVertex3f( -0.3f,  0.3f,  0.3f ); /* Top Left Of The Quad (Front)     */
      glVertex3f( -0.3f, -0.3f,  0.3f ); /* Bottom Left Of The Quad (Front)  */
      glVertex3f(  0.3f, -0.3f,  0.3f ); /* Bottom Right Of The Quad (Front) */

      glColor3f(   1.0f,  0.3f,  0.0f ); /* Set The Color To Yellow          */
      glVertex3f(  0.3f, -0.3f, -0.3f ); /* Bottom Left Of The Quad (Back)   */
      glVertex3f( -0.3f, -0.3f, -0.3f ); /* Bottom Right Of The Quad (Back)  */
      glVertex3f( -0.3f,  0.3f, -0.3f ); /* Top Right Of The Quad (Back)     */
      glVertex3f(  0.3f,  0.3f, -0.3f ); /* Top Left Of The Quad (Back)      */

      glColor3f(   0.0f,  0.0f,  1.0f ); /* Set The Color To Blue            */
      glVertex3f( -0.3f,  0.3f,  0.3f ); /* Top Right Of The Quad (Left)     */
      glVertex3f( -0.3f,  0.3f, -0.3f ); /* Top Left Of The Quad (Left)      */
      glVertex3f( -0.3f, -0.3f, -0.3f ); /* Bottom Left Of The Quad (Left)   */
      glVertex3f( -0.3f, -0.3f,  0.3f ); /* Bottom Right Of The Quad (Left)  */

      glColor3f(   1.0f,  0.0f,  1.0f ); /* Set The Color To Violet          */
      glVertex3f(  0.3f,  0.3f, -0.3f ); /* Top Right Of The Quad (Right)    */
      glVertex3f(  0.3f,  0.3f,  0.3f ); /* Top Left Of The Quad (Right)     */
      glVertex3f(  0.3f, -0.3f,  0.3f ); /* Bottom Left Of The Quad (Right)  */
      glVertex3f(  0.3f, -0.3f, -0.3f ); /* Bottom Right Of The Quad (Right) */
	glEnd();
	glLoadIdentity();
}
